package edu.uwosh.cs342.group1;

import java.util.List;

import edu.uwosh.cs342.group1.database.DbCloudHelper;
import edu.uwosh.cs342.group1.storage.Scores;
import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class AllScoresActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) { 
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        List<Scores> scores = new DbCloudHelper().GetAllScores();
        ListView listView = (ListView)findViewById(R.id.listView1);
        
        if(scores != null && scores.size() > 0) {
        	Scores[] scoreArray = new Scores[1];
        	scoreArray = scores.toArray(scoreArray);
        	
        	ArrayAdapter<Scores> arrayAdapt = new ArrayAdapter<Scores>(this,R.layout.quiz_layout, scoreArray);
        	listView.setAdapter(arrayAdapt);
        }
    }

}
